AC_INIT(LibEx, 1.0.2, alcione.sombra@gmail.com, libex, http://www.alcionesytes.net)
AC_PREREQ([2.50])
AC_CONFIG_AUX_DIR([.])
AM_INIT_AUTOMAKE([dist-xz 1.11 gnu -Wall -Wmultichar -Woverflow])
AC_CONFIG_MACRO_DIR([m4])
m4_pushdef([AC_INCLUDES_DEFAULT], [$1])
AC_COPYRIGHT([Alcione Ferreira])
AC_REVISION([$Revision: 1.0.2 $])

AC_CONFIG_HEADERS([src/configex.h])
LT_INIT([static])
AC_PROG_CXX
AC_PROG_LD
AC_LANG([C++])
######################################################################
# DOXYGEN SUPPORT
######################################################################

DX_HTML_FEATURE(ON)
DX_CHM_FEATURE(OFF)
DX_CHI_FEATURE(OFF)
DX_MAN_FEATURE(OFF)
DX_RTF_FEATURE(OFF)
DX_XML_FEATURE(OFF)
DX_PDF_FEATURE(ON)
DX_PS_FEATURE(ON)

DX_INIT_DOXYGEN([$PACKAGE_NAME],[doxygen.cfg],[doc])

######################################################################
AM_PROG_LIBTOOL
AC_PREFIX_DEFAULT([/usr])

AC_SUBST([AM_CXXFLAGS])
AC_SUBST([AM_LDFLAGS])

AC_HEADER_STDC
AC_CHECK_HEADERS([iostream string fstream vector])
AC_CHECK_HEADERS([ctime cstdio cstdlib ctype.h ltdl.h dlfcn.h])
AC_SEARCH_LIBS([lt_dlopen], [ltdl])
AC_SEARCH_LIBS([dlopen], [dl])
PKG_CHECK_MODULES([SSL], [openssl >= 0.9.8])

AC_SUBST([LIBEX_SO_VERSION], [1:0:1])
AC_SUBST([LIBEX_API_VERSION], [1.0])

AC_CONFIG_FILES([Makefile src/Makefile man/Makefile libex-${LIBEX_API_VERSION}.pc:libex.pc.in])
#Definindo topo do config.h
AH_TOP([
#ifndef __CONFIGEX_H__
#define __CONFIGEX_H__ 1

#if  defined(__WIN32__) || defined(__WIN__)
#define NO_LINUX 1
#include <window.h>
#endif
])

AH_BOTTOM([
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# ifdef HAVE_SYS_TIME_H
#  include <sys/time.h>
# else
#  include <time.h>
# endif
#endif
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# ifdef HAVE_STDLIB_H
#  include <stdlib.h>
# endif
#endif
#ifdef HAVE_STRING_H
# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
#  include <memory.h>
# endif
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_LIBM
# include <math.h>
#endif
#ifdef HAVE_IOSTREAM
# include <iostream>
#endif
#ifdef HAVE_STRING
# include <string>
#endif
#ifdef HAVE_FSTREAM
# include <fstream>
#endif
#ifdef HAVE_VECTOR
# include <vector>
#endif
#ifdef HAVE_MEMORY
# include <memory>
#endif
#ifdef HAVE_CTIME
# include <ctime>
#endif
#ifdef HAVE_CSTDIO
# include <cstdio>
#endif
#ifdef HAVE_CSTDLIB
# include <cstdlib>
#endif
#ifdef HAVE_CTYPE_H
# include <ctype.h>
#endif
#ifdef HAVE_LTDL_H
# include <ltdl.h>
#endif
#ifdef HAVE_DLFCN_H
# include <dlfcn.h>
#endif
#ifdef HAVE_LIBEX_H
# include <libex.h>
#endif

#if defined(__APPLE__)
#  define COMMON_DIGEST_FOR_OPENSSL
#  include <CommonCrypto/CommonDigest.h>
#  define SHA1 CC_SHA1
#else
#  include <openssl/md5.h>
#endif

#endif /*__CONFIG_H__*/
])

AC_OUTPUT
